package com.fjut.kms.service;

/**
 * Created by lv on 2017/8/30.
 */
import com.fjut.kms.dao.UserActRecordDao;
import com.fjut.kms.dao.UserActRecordJDBCImpl;
import com.fjut.kms.domain.UserActRecord;
import com.fjut.kms.exception.KMSException;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Empathy on 2017/7/30.
 */
public class UserActRecordServiceImpl implements UserActRecordService {
    public void add(UserActRecord uar){
        UserActRecordDao uasDao=new UserActRecordJDBCImpl();
        uasDao.addUserActRecord(uar);
    }

    public List<Object> get(String userName,String softName){
        if ("".equals(userName)) throw new KMSException("Username为空");
        UserActRecordDao uasDao=new UserActRecordJDBCImpl();
        List<UserActRecord> uarList=new ArrayList<UserActRecord>();
        List<Object> list=new ArrayList<Object>();
        uarList=uasDao.getUserActRecordBySoftName(userName,softName);
        for (int i=0;i<uarList.size();i++){
            list.add(uarList.get(i));
        }
        return list.size()>0?list:null;
    }
}
